package com.mj.haier.calc.repository;

import com.mj.haier.calc.domain.AzFinSettleBill;
import com.mj.haier.calc.domain.ItfOutcomeStatmentDetailBean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * Spring Data  repository for the AzFinSettleBill entity.
 */
@SuppressWarnings("unused")
@Repository
public interface AzFinSettleBillRepository extends JpaRepository<AzFinSettleBill, Long> {


    @Query(nativeQuery = true,value = "select " +
        "t.settle_batch_id AS docNo," +
        "t.order_code AS orderNo," +
        "t.product_name AS productName," +
        "t.product_model_no AS productVersion," +
        "t.source_name_code AS sourceNameCode," +
        "t.source_name AS sourceName," +
        "'B01' AS accountType," +
        "t.server_close_time AS finishDate," +
        "0 AS transportAmt," +
        "0 AS installAmt," +
        "0 AS longDistanceAmt," +
        "t.settle_operate_cost AS operateAmt," +
        "t.settle_service_type_cost AS serviceTypeAmt," +
        "t.settle_traffic_cost AS trafficAmt," +
        "t.settle_meterial_cost AS meterialAmt," +
        "t.settle_subidy_cost AS subidyAmt," +
        "t.settle_compensatory_cost AS compensatoryAmt," +
        "t.settle_reward_cost AS rewardAmt," +
        "SYSDATE() AS gmtCreate," +
        "t.settle_fee_total_cost AS totalAmt from az_fin_settle_bill t where t.settle_item = '1' and t.trade_code = ?1 AND t.settle_batch_id = ?2 ")
    List<ItfOutcomeStatmentDetailBean> findAllBySettleBatchId(String tradeCode, String settleBatchId);

}
